<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
function my_substr($str,$n)
{
    //求字符中$str的长度
    $len=mb_strlen($str,'utf-8');
    if ($len>$n)
    {
        return mb_substr($str,0,$n,'utf-8')."...";
    }
    else
    {
        return $str;
    }
}

